home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / mus / play / tracker_4_31.lzh / tracker / Arch / SBOS2 / sbos2_user.h < prev   
C/C++ Source or Header  |  1995-05-15  |  7KB  |  214 lines

  1. /*======================================================================
  2.  
  3. MSF - This is user header for SBOS2.SYS versions 0.91
  4. MSF - this is part of SBOS2, original header below.
  5.  
  6.    Header file for Sound Blaster user programs.
  7.    [ This file is a part of SBlast-BSD-1.4 ]
  8.  
  9.    Steve Haehnichen <shaehnic@ucsd.edu>
  10.  
  11.    $Id: sbos2_user.h,v 1.2 1995/05/15 13:16:49 espie Exp espie $
  12.  
  13.  
  14.    Copyright (C) 1992 Steve Haehnichen.
  15.  
  16.    This program is free software; you can redistribute it and/or modify
  17.    it under the terms of the GNU General Public License as published by
  18.    the Free Software Foundation; either version 1, or (at your option)
  19.    any later version.
  20.  
  21.    This program is distributed in the hope that it will be useful,
  22.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  23.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  24.    GNU General Public License for more details.
  25.  
  26.    You should have received a copy of the GNU General Public License
  27.    along with this program; if not, write to the Free Software
  28.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  29.  
  30.  * $Log: sbos2_user.h,v $
  31.  * Revision 1.2  1995/05/15  13:16:49  espie
  32.  * Updated.
  33.  *
  34.  * Revision 1.1  1995/02/08  13:16:22  espie
  35.  * Initial revision
  36.  *
  37.  * Revision 1.5  1992/06/13  01:48:15  steve
  38.  * Released in SBlast-BSD-1.4
  39.  
  40. ======================================================================*/
  41.  
  42. #ifndef SBLAST_H
  43. #define SBLAST_H
  44.  
  45.  
  46. typedef unsigned char FLAG;
  47.  
  48. /*
  49.  * Available compression modes
  50.  * (These are actually DSP DMA-start commands, but you don't care)
  51.  */
  52. enum
  53. {
  54.   PCM_8     = 0x14,        /* Straight 8-bit PCM */
  55.   ADPCM_4     = 0x74,        /* 4-bit ADPCM compression */
  56.   ADPCM_2_6    = 0x76,        /* 2.5-bit ADPCM compression */
  57.   ADPCM_2     = 0x16,        /* 2-bit ADPCM compression */
  58. };
  59.  
  60. enum { 
  61.   CH_LEFT, CH_RIGHT, CH_BOTH
  62. };    /* Stereo channel choices */
  63.  
  64. /*   IOCTLs for FM, Mixer, and DSP control.   */
  65.  
  66. /* MSF - Define category for SBDSP ioctl requests (DSP and MIXER actually) */
  67. #define DSP_CAT   0x80
  68.  
  69. /*
  70.  * FM: Reset chips to silence
  71.  *     Play a note as defined by struct sb_fm_note
  72.  *     Set global FM parameters as defined by struct sb_fm_params
  73.  */
  74. /* MSF - use same functions codes as original driver */
  75. #define FM_IOCTL_RESET          10
  76. #define FM_IOCTL_PLAY_NOTE      11
  77. #define FM_IOCTL_SET_PARAMS     13
  78.  
  79. /* Mixer: Set mixer volume levels
  80.  *        Set mixer control parameters (non-volume stuff)
  81.  *      Read current mixer volume levels
  82.  *      Read current mixer parameters
  83.  *      Reset the mixer to a default state
  84.  */      
  85. #define MIXER_IOCTL_SET_LEVELS     20
  86. #define MIXER_IOCTL_SET_PARAMS     21
  87. #define MIXER_IOCTL_READ_LEVELS    22
  88. #define MIXER_IOCTL_READ_PARAMS 23
  89. #define MIXER_IOCTL_RESET     24
  90.  
  91. /* DSP: Reset the DSP and terminate any transfers.
  92.  *      Set the speed (in Hz) of DSP playback/record.
  93.  *      (Note that the speed parameter is modified to be the actual speed.)
  94.  *      Turn the DSP voice output on (non-zero) or off (0)
  95.  *      Flush any pending written data.
  96.  *      Set the DSP decompression mode to one of the above modes.
  97.  *      Set Stereo playback/record on (non-zero) or off (0)
  98.  *      Set the DMA transfer buffer size
  99.  *      Set error when there is recording overrun (ESUCCESS for ignore)
  100.  */
  101. #define DSP_IOCTL_RESET     0
  102. #define DSP_IOCTL_SPEED     1
  103. #define DSP_IOCTL_VOICE     2
  104. #define DSP_IOCTL_FLUSH     3
  105. #define DSP_IOCTL_COMPRESS    4
  106. #define DSP_IOCTL_STEREO    5
  107. #define DSP_IOCTL_BUFSIZE       6
  108. #define DSP_IOCTL_OVERRUN_ERRNO 7
  109.  
  110. /* DSP legal speed range (really!) */
  111. #define        DSP_MAX_SPEED_PRO    43478
  112. #define         DSP_MAX_SPEED_REG       22222
  113. #define        DSP_MIN_SPEED    3906
  114.  
  115. /* define largest, smallest sizes for transfer buffer size */
  116. #define DSP_MIN_BUFSIZE 256
  117. #define DSP_MAX_BUFSIZE (64*1024-2)
  118.  
  119. struct stereo_vol
  120. {
  121.   BYTE l;            /* Left volume */
  122.   BYTE r;            /* Right volume */
  123. };
  124.  
  125.  
  126. /*
  127.  * Mixer volume levels for MIXER_IOCTL_SET_VOL & MIXER_IOCTL_READ_VOL
  128.  */
  129. struct sb_mixer_levels
  130. {
  131.   struct stereo_vol master;    /* Master volume */
  132.   struct stereo_vol voc;    /* DSP Voice volume */
  133.   struct stereo_vol fm;        /* FM volume */
  134.   struct stereo_vol line;    /* Line-in volume */
  135.   struct stereo_vol cd;        /* CD audio */
  136.   BYTE mic;            /* Microphone level */
  137. };
  138.  
  139. /*
  140.  * Mixer parameters for MIXER_IOCTL_SET_PARAMS & MIXER_IOCTL_READ_PARAMS
  141.  */
  142. struct sb_mixer_params
  143. {
  144.   BYTE record_source;        /* Recording source (See SRC_xxx below) */
  145.   FLAG hifreq_filter;        /* Filter frequency (hi/low) */
  146.   FLAG filter_input;        /* ANFI input filter */
  147.   FLAG filter_output;        /* DNFI output filter */
  148.   FLAG dsp_stereo;        /* 1 if DSP is in Stereo mode */
  149. };
  150. #define SRC_MIC         1    /* Select Microphone recording source */
  151. #define SRC_CD          3    /* Select CD recording source */
  152. #define SRC_LINE        7    /* Use Line-in for recording source */
  153.  
  154.  
  155. /*
  156.  * Data structure composing an FM "note" or sound event.
  157.  */
  158. struct sb_fm_note
  159. {
  160.   BYTE channel;            /* LEFT, RIGHT, or BOTH */
  161.   BYTE operator;        /* Operator cell (0 or 1) */
  162.   BYTE voice;            /* FM voice (0 to 8) */
  163.  
  164.   /* Per operator: */
  165.   BYTE waveform;        /* 2 bits: Select wave shape (see WAVEFORM) */
  166.   FLAG am;            /* Amplitude modulation */
  167.   FLAG vibrato;            /* Vibrato effect */
  168.   FLAG do_sustain;        /* Do sustain phase, or skip it */
  169.   FLAG kbd_scale;        /* Keyboard scaling? */
  170.  
  171.   BYTE harmonic;        /* 4 bits: Which harmonic to generate */
  172.   BYTE scale_level;        /* 2 bits: Decrease output as freq rises*/
  173.   BYTE volume;            /* 6 bits: Intuitive volume */
  174.  
  175.   BYTE attack;            /* 4 bits: Attack rate */
  176.   BYTE decay;            /* 4 bits: Decay rate */
  177.   BYTE sustain;            /* 4 bits: Sustain level */
  178.   BYTE release;            /* 4 bits: Release rate */
  179.  
  180.   /* Apply to both operators of one voice: */
  181.   BYTE feedback;        /* 3 bits: How much feedback for op0 */
  182.   FLAG key_on;            /* Set for active, Clear for silent */
  183.   FLAG indep_op;        /* Clear for op0 to modulate op1,
  184.                    Set for parallel tones. */
  185.  
  186.   /* Freq = 50000 * Fnumber * 2^(octave - 20) */
  187.   BYTE octave;            /* 3 bits: What octave to play (0 = low) */
  188.   unsigned int fnum;        /* 10 bits: Frequency "number" */
  189. };
  190.  
  191. /*
  192.  * FM parameters that apply globally to all voices, and thus are not "notes"
  193.  */
  194. struct sb_fm_params
  195. {
  196.   BYTE channel;            /* LEFT, RIGHT, or BOTH, as defined above */
  197.  
  198.   FLAG am_depth;        /* Amplitude Modulation depth (1=hi) */
  199.   FLAG vib_depth;        /* Vibrato depth (1=hi) */
  200.   FLAG wave_ctl;        /* Let voices select their waveform */
  201.   FLAG speech;            /* Composite "Speech" mode (?) */
  202.   FLAG kbd_split;        /* Keyboard split */
  203.   FLAG rhythm;            /* Percussion mode select */
  204.  
  205.   /* Percussion instruments */
  206.   FLAG bass;
  207.   FLAG snare;
  208.   FLAG tomtom;
  209.   FLAG cymbal;
  210.   FLAG hihat;
  211. };
  212.  
  213. #endif                /* !def SBLAST_H */
  214.